home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77687_log_prop.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  23.6 KB  |  684 lines

  1. <%@ Language=VBScript %>
  2. <% Option Explicit      %>
  3. <% 
  4.     '-------------------------------------------------------------------------
  5.     ' Log_prop.asp:    Serves in Editing Log Properties.
  6.     ' Copyright (c) Microsoft Corporation.  All rights reserved. 
  7.     '-------------------------------------------------------------------------
  8. %>
  9.     <!-- #include virtual="/admin/inc_framework.asp" -->
  10.     <!-- #include file="loc_event.asp" -->
  11.     <!-- #include file="inc_log.asp" -->
  12.         
  13. <%  '------------------------------------------------------------------------- 
  14.     'Global Variables
  15.     '-------------------------------------------------------------------------
  16.     Dim page    'Variable that receives the output page object when 
  17.                 'creating a page 
  18.     Dim rc        'Return value for CreatePage
  19.     
  20.     'wmi constant used to save the wmi settings
  21.     Const WMICONST="131072"
  22.     Const UINT_FORMAT=4294967296
  23.     '-------------------------------------------------------------------------
  24.     'Global Form Variables
  25.     '-------------------------------------------------------------------------
  26.     Dim F_strEvent                'To get the title from previous page
  27.     Dim F_strSize                'LogFile size
  28.     Dim F_strCreated            'Log File Created date
  29.     Dim F_strModified            'Log File modified date
  30.     Dim F_strAccessed            'Log file last accessed date
  31.     Dim F_strMaxLogsize            'log file maximum size
  32.     Dim F_strOverwritePolicy    'Overwrite policy
  33.     Dim F_strOverwriteOutdated    'Overwrite outdated  policy
  34.     Dim arrTitle(1)
  35.     
  36.     'getting the type of log from previous page
  37.     F_strEvent=Request.QueryString("Title")    
  38.     
  39.     'Localisation of page title
  40.     arrTitle(0) = GetLocalizationTitle(F_strEvent)    
  41.     
  42.     L_PAGETITLE_PROP_TEXT = SA_GetLocString("event.dll", "403F0033", arrTitle)
  43.     
  44.     'Create a Property Page
  45.     Call SA_CreatePage(L_PAGETITLE_PROP_TEXT,"",PT_PROPERTY,page)
  46.     Call SA_ShowPage(page)
  47.     
  48.     '-------------------------------------------------------------------------
  49.     'Function:                OnInitPage()
  50.     'Description:            Called to signal first time processing for this page.
  51.     '                        Use this method to do first time initialization tasks
  52.     'Input Variables:        PageIn,EventArg
  53.     'Output Variables:        None
  54.     'Returns:                True/False
  55.     'Global Variables:        None
  56.     '-------------------------------------------------------------------------    
  57.     Public Function OnInitPage(ByRef PageIn,ByRef EventArg)
  58.         
  59.         'Serves in Getting the Properties of selected Log
  60.         OnInitPage = GetLogProp()
  61.     
  62.     End Function
  63.     
  64.     '-------------------------------------------------------------------------
  65.     'Function:                OnServePropertyPage()
  66.     'Description:            Called when the page needs to be served.Use this 
  67.     '                        method to serve content
  68.     'Input Variables:        PageIn,EventArg
  69.     'Output Variables:        None
  70.     'Returns:                True/False
  71.     'Global Variables:        None
  72.     '-------------------------------------------------------------------------    
  73.     Public Function OnServePropertyPage(ByRef PageIn,ByRef EventArg)
  74.         Dim oEncoder
  75.         Set oEncoder = new CSAEncoder
  76.         
  77.         Call ServeCommonJavaScript()
  78. %>
  79.         <table>
  80.             <tr>
  81.                 <td class="TasksBody"  nowrap>
  82.                     <%=oEncoder.EncodeElement(L_SIZE_TEXT)%>
  83.                 </td>
  84.                 <td class="TasksBody"  nowrap>  
  85.                 </td>
  86.                 <td class="TasksBody"> <%=oEncoder.EncodeElement(F_strSize)%>
  87.                 </td>
  88.             </tr>
  89.             <tr>
  90.                 <td nowrap class="TasksBody">
  91.                     <%=oEncoder.EncodeElement(L_CREATEDDATE_TEXT)%>
  92.                 </td>
  93.                 <td class="TasksBody">  
  94.                 </td>
  95.                 <td class="TasksBody"  nowrap> <%=oEncoder.EncodeElement(F_strCreated)%>
  96.                 </td>
  97.             </tr>
  98.             <tr>
  99.                 <td nowrap class="TasksBody">
  100.                     <%=oEncoder.EncodeElement(L_MODIFIEDDATE_TEXT)%>
  101.                 </td>
  102.                 <td class="TasksBody">  
  103.                 </td>
  104.                 <td class="TasksBody"  nowrap> <%=oEncoder.EncodeElement(F_strModified)%>
  105.                 </td>
  106.             </tr>
  107.             <tr>
  108.                 <td nowrap class="TasksBody">
  109.                     <%=oEncoder.EncodeElement(L_ACCESSEDDATE_TEXT)%>
  110.                 </td>
  111.                 <td class="TasksBody">  
  112.                 </td>
  113.                 <td class="TasksBody" nowrap>
  114.                     <%=oEncoder.EncodeElement(F_strAccessed)%>
  115.                 </td>
  116.             </tr>
  117.             <tr>
  118.                 <td nowrap colspan=3 class="TasksBody">  </td>
  119.             </tr>
  120.             <tr>
  121.                 <td nowrap colspan=3 class="TasksBody">
  122.                     <%=oEncoder.EncodeElement(L_LOGSIZE_TEXT)%>
  123.                 </td>
  124.             </tr>
  125.             <tr>
  126.                 <td nowrap colspan=3 class="TasksBody">
  127.                     <table>
  128.                         <tr>
  129.                             <td nowrap class="TasksBody">      <%=oEncoder.EncodeElement(L_MAXIMUMLOGSIZE_TEXT)%></td>
  130.                             <td class="TasksBody"> <INPUT class ="FormField" TYPE = "text" size=10 Name ="txtMaximumlogsize" id=txtMaximumlogsize value=<%=oEncoder.EncodeAttribute(F_strMaxLogsize)%> OnKeyPress="JavaScript:checkKeyforNumbers(this);ClearErr()"  onblur ="ValidatePage()" maxlength=7 ></td>
  131.                             <td class="TasksBody"><table cellpadding=0 cellspacing=0 border=0>
  132.                                     <tr>
  133.                                         <td class="TasksBody"><img src="/admin/images/up.gif" onclick =IncrementLogSize() name=incrMaxSize></td>
  134.                                     </tr>
  135.                                     <tr>
  136.                                         <td class="TasksBody"><img src="/admin/images/down.gif" onclick = DecrementLogSize() name=decrMaxSize></td>
  137.                                     </tr>
  138.                                 </table>
  139.                             </td>
  140.                             <td nowrap class="TasksBody">  <%=oEncoder.EncodeElement(L_KB_TEXT)%></td>
  141.                         </tr>
  142.                     </table>
  143.                 </td>
  144.             </tr>
  145.             <tr><td class="TasksBody"> </td></tr>
  146.             <tr>
  147.                 <td nowrap colspan=3 class="TasksBody">
  148.                           <%=oEncoder.EncodeElement(L_WHENMAXIMUMREACHED_TEXT)%>
  149.                 </td>
  150.             </tr>
  151.             </tr><tr><td class="TasksBody"> </td></tr>
  152.  
  153.             <tr>
  154.                 <td nowrap colspan=3 class="TasksBody"><table>
  155.                 <tr>
  156.                 <td class="TasksBody"  nowrap>
  157.                          <INPUT class ="FormField" TYPE = "radio" Name ="rdoOverwrite" onclick="JavaScript:Changemode(this.value);ClearErr()"
  158.                      <%IF F_strOverwritePolicy="WhenNeeded" then 
  159.                          Response.Write "checked value='WhenNeeded'>"
  160.                      else
  161.                          Response.Write " value='WhenNeeded'>"
  162.                      end if %> 
  163.                      <%=oEncoder.EncodeElement(L_OVERWRITEEVENTS_ASNEEDED_TEXT)%> 
  164.                 </td>
  165.                 </tr>
  166.                 </table>
  167.                 </td>
  168.             </tr>
  169.             <tr>
  170.                 <td nowrap colspan=3 class="TasksBody"><table>
  171.                     <tr>
  172.                     <td class="TasksBody"  nowrap>
  173.                          <INPUT class ="FormField" TYPE = "radio"  Name ="rdoOverwrite" onclick="JavaScript:Changemode(this.value);ClearErr()" onfocus="JavaScript:Changemode(this.value);ClearErr()" 
  174.                     <%IF F_strOverwritePolicy="OutDated" then 
  175.                          Response.Write "checked value='OutDated'>"
  176.                      else
  177.                          Response.Write " value='OutDated'>"
  178.                      end if %>
  179.                      <%=oEncoder.EncodeElement(L_OVERWRITEEVENTS_OLDERTHAN_TEXT)%>
  180.                      </td>
  181.                      
  182.                             <td class="TasksBody"> <INPUT class ="FormField" TYPE = "text" size=10 Name ="txtTimeindays" OnKeyPress="checkKeyforNumbers(this)"  value=<%=oEncoder.EncodeAttribute(F_strOverwriteOutdated)%> onblur ="ValidatePage()" maxlength=3></td>
  183.                             <td class="TasksBody"><table cellpadding=0 cellspacing=0 border=0>
  184.                                     <tr>
  185.                                         <td class="TasksBody"><img src="/admin/images/up.gif" onclick ="IncrementTimeinDays()" name="incrTimeinDays"></td>
  186.                                     </tr>
  187.                                     <tr>
  188.                                         <td class="TasksBody"><img src="/admin/images/down.gif" onclick = "DecrementTimeinDays()" name="decrTimeinDays"></td>
  189.                                     </tr>
  190.                                 </table>
  191.                             </td><td class="TasksBody"  nowrap>  <%=oEncoder.EncodeElement(L_DAYS_TEXT)%></td></tr></table>
  192.                 </td>
  193.             </tr>
  194.             <tr>
  195.                 <td nowrap colspan=3 class="TasksBody">
  196.                 
  197.                     <table>
  198.                     <tr>
  199.                     <td class="TasksBody" nowrap>
  200.                          <INPUT class ="FormField" TYPE = "radio" Name ="rdoOverwrite" onclick="Changemode(this.value)" <%IF F_strOverwritePolicy="Never" then 
  201.                          Response.Write "checked value='Never'>"
  202.                      else
  203.                          Response.Write "value='Never'>"
  204.                      end if %>
  205.                     <%=oEncoder.EncodeElement(L_DONOTOVERWRITEEVENTS_TEXT)%>
  206.                 </td>
  207.                 </tr>
  208.                 </table>
  209.                 </td>
  210.             </tr>
  211.         </table>
  212.         
  213.         <input type="hidden" name="hidTempTimeinDays">
  214.         <input type="hidden" name="hidEvent" Value="<%=F_strEvent%>">
  215.         <input type="hidden" name="hidFileSize" Value="<%=F_strSize%>">
  216.         <input type="hidden" name="hidFileCreated" Value="<%=F_strCreated%>">
  217.         <input type="hidden" name="hidFileModified" Value="<%=F_strModified%>">
  218.         <input type="hidden" name="hidFileAccessed" Value="<%=F_strAccessed%>">
  219.         <input type="hidden" name="hidMaxLogsize" Value="<%=F_strMaxLogsize%>">
  220.         <input type="hidden" name="hidOverWritePolicy" Value="<%=F_strOverwritePolicy%>">
  221.         <input type="hidden" name="hidOverWriteOutDated" Value="<%=F_strOverwriteOutdated%>">
  222. <%
  223.         OnServePropertyPage=TRUE
  224.  
  225.     End Function
  226.  
  227.     '-------------------------------------------------------------------------
  228.     'Function:                OnPostBackPage()
  229.     'Description:            Called to signal that the page has been posted-back.
  230.     'Input Variables:        PageIn,EventArg
  231.     'Output Variables:        None
  232.     'Returns:                True/False
  233.     'Global Variables:        None
  234.     '-------------------------------------------------------------------------
  235.     Public Function OnPostBackPage(ByRef PageIn,ByRef EventArg)
  236.         OnPostBackPage=TRUE
  237.     End Function
  238.     
  239.     '-------------------------------------------------------------------------
  240.     'Function:                OnSubmitPage()
  241.     'Description:            Called when the page has been submitted for processing.
  242.     '                        Use this method to process the submit request.
  243.     'Input Variables:        PageIn,EventArg
  244.     'Output Variables:        None
  245.     'Returns:                True/False
  246.     'Global Variables:        None
  247.     '-------------------------------------------------------------------------
  248.     Public Function OnSubmitPage(ByRef PageIn,ByRef EventArg)
  249.         
  250.         'getting the values from form after form submission
  251.         F_strEvent=Request.Form("hidEvent")
  252.         F_strSize=Request.Form("hidFileSize")
  253.         F_strCreated=Request.Form("hidFileCreated")
  254.         F_strModified=Request.Form("hidFileModified")
  255.         F_strAccessed=Request.Form("hidFileAccessed")
  256.         F_strMaxLogsize=Request.Form("hidMaxLogSize")
  257.         F_strOverwritePolicy=Request.Form("hidOverWritePolicy") 
  258.         F_strOverwriteOutdated=Request.Form("hidOverWriteOutDated")
  259.         OnSubmitPage=EditLogProp()
  260.     
  261.     End Function
  262.         
  263.     '-------------------------------------------------------------------------
  264.     'Function:                OnClosePage()
  265.     'Description:            Called when the page is about to be closed.Use this method
  266.     '                        to perform clean-up processing
  267.     'Input Variables:        PageIn,EventArg
  268.     'Output Variables:        None
  269.     'Returns:                True/False
  270.     'Global Variables:        None
  271.     '-------------------------------------------------------------------------    
  272.     Public Function OnClosePage(ByRef PageIn,ByRef EventArg)
  273.         'ServeClose()
  274.         OnClosePage=TRUE
  275.     End Function
  276.  
  277.     
  278.     '---------------------------------------------------------------------
  279.     ' Function:    ServeCommonJavaScript
  280.     '
  281.     ' Synopsis:    Serve common javascript that is required for this page type.
  282.     '
  283.     '---------------------------------------------------------------------
  284.     
  285.     Function ServeCommonJavaScript()
  286. %>
  287.         <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  288.         </script>
  289.         <script language="JavaScript">
  290.         
  291.             // Set the initial form values
  292.             function Init()
  293.             {
  294.                 document.frmTask.txtMaximumlogsize.focus()                
  295.                 if(getRadioButtonValue(document.frmTask.rdoOverwrite)=="OutDated")
  296.                     document.frmTask.txtTimeindays.disabled=false
  297.                 else
  298.                     document.frmTask.txtTimeindays.disabled=true
  299.                     
  300.             }
  301.             
  302.             function ValidatePage()
  303.             {
  304.                 var intMaxLogsize=4194240    //Maximum log size
  305.                 var intMinLogsize=64        //Minimum log size
  306.                 var intMaxLogdays=365        //Maximum Log days
  307.                 var intMinLogdays=1            //Minimum Log days
  308.                 var intLogIncrement=64        //Log Increment                            
  309.                 var intMaximumlogsize = parseInt(document.frmTask.txtMaximumlogsize.value,10)
  310.                 var intTimeindays = parseInt(document.frmTask.txtTimeindays.value,10)
  311.                 var intLogMultiple
  312.                 
  313.                     if(isNaN(document.frmTask.txtTimeindays.value))
  314.                     {                    
  315.                     if(parseInt(document.frmTask.hidTempTimeinDays.value)> intMinLogdays)
  316.                         document.frmTask.txtTimeindays.value = parseInt(document.frmTask.hidTempTimeinDays.value)
  317.                     else
  318.                         {
  319.                         document.frmTask.txtTimeindays.value = intMinLogdays
  320.                         intDays = intTimeindays;
  321.                         return false;
  322.                         }
  323.                    }        
  324.                  if(isNaN(document.frmTask.txtMaximumlogsize.value))
  325.                     {
  326.                     document.frmTask.txtMaximumlogsize.value = intMinLogsize
  327.                     return false;
  328.                     }                            
  329.                 else if(intMaximumlogsize > intMaxLogsize)
  330.                     {
  331.                     document.frmTask.txtMaximumlogsize.value=intMaxLogsize
  332.                     
  333.                     
  334.                     return false;
  335.                     }
  336.                 
  337.                 else if (document.frmTask.txtMaximumlogsize.value=="")
  338.                     {
  339.                     document.frmTask.txtMaximumlogsize.value =intLogIncrement
  340.                     return false;
  341.                     }
  342.                 else if(intMaximumlogsize < intMinLogsize)
  343.                     {
  344.                     document.frmTask.txtMaximumlogsize.value = intLogIncrement
  345.                     return false;
  346.                     }
  347.                 else if(intTimeindays > intMaxLogdays)  
  348.                     {
  349.                     document.frmTask.txtTimeindays.value =parseInt(document.frmTask.txtTimeindays.value)-365
  350.                      
  351.                     return false;
  352.                     }
  353.                 else if(intTimeindays < intMinLogdays)
  354.                     {
  355.                     document.frmTask.txtTimeindays.value=intMinLogdays
  356.                     
  357.                     return false;
  358.                     }
  359.                 
  360.                 else if((intMaximumlogsize)%intLogIncrement!= 0)
  361.                     {
  362.                         //Rounding the number to next multiple of 64
  363.                         intLogMultiple=intMaximumlogsize/intLogIncrement;
  364.                         intLogMultiple=Math.floor(intLogMultiple)+1;
  365.                         document.frmTask.txtMaximumlogsize.value = intLogIncrement*intLogMultiple;
  366.                         return false;
  367.                     }
  368.                 else if(document.frmTask.txtTimeindays.value =="")
  369.                     {
  370.                         intDays = intTimeindays;
  371.                         document.frmTask.txtTimeindays.value = intMinLogdays
  372.                         return false;
  373.                     }    
  374.                     else    
  375.                     {
  376.                         return true;    
  377.                     }
  378.             }
  379.             //Function to increment the Maximum log size text box
  380.             function IncrementLogSize()
  381.             {
  382.                 var intLogIncr=64;
  383.                 var intMaximumlogsize = parseInt(document.frmTask.txtMaximumlogsize.value,10);
  384.                 var intMultiple;
  385.                 var intMod;        
  386.                 if (intMaximumlogsize==4194240)
  387.                     {    
  388.                         document.frmTask.txtMaximumlogsize.value=intLogIncr;
  389.                     }
  390.                 else
  391.                 { 
  392.                     document.frmTask.txtMaximumlogsize.value=intMaximumlogsize + intLogIncr;
  393.                 }
  394.                    
  395.             
  396.             }
  397.             //Function to decrement the Maximum log size text box
  398.             function DecrementLogSize()
  399.             {
  400.                 var intLogDecr = 64;
  401.                 var intMaxLog = 4194240;
  402.                 var intMaximumlogsize = parseInt(document.frmTask.txtMaximumlogsize.value,10);    
  403.                 var intMultiple;
  404.                 var intMod;        
  405.                 
  406.                 if(intMaximumlogsize<=64)
  407.                 {
  408.                       document.frmTask.txtMaximumlogsize.value = intMaxLog;
  409.                 }
  410.                    
  411.                 else 
  412.                         document.frmTask.txtMaximumlogsize.value = intMaximumlogsize -intLogDecr    
  413.                                 
  414.             }
  415.             //Function to increment Overwrite events older than text box
  416.             function IncrementTimeinDays()
  417.             {
  418.               
  419.                 if (parseInt(document.frmTask.txtTimeindays.value)==365)
  420.                  document.frmTask.txtTimeindays.value =0
  421.                 if (parseInt(document.frmTask.txtTimeindays.value)>365)
  422.                  document.frmTask.txtTimeindays.value =parseInt(document.frmTask.txtTimeindays.value)-365 
  423.                     
  424.                 if (isNaN(document.frmTask.txtTimeindays.value))
  425.                 {
  426.                     document.frmTask.txtTimeindays.value = parseInt(document.frmTask.hidTempTimeinDays.value)+1
  427.                             
  428.                 }else
  429.                 {
  430.                     document.frmTask.txtTimeindays.value =parseInt(document.frmTask.txtTimeindays.value,10) + 1
  431.                     document.frmTask.hidTempTimeinDays.value =document.frmTask.txtTimeindays.value 
  432.                         
  433.                 }
  434.             }
  435.             //Function to decrement Overwrite events older than text box
  436.             function DecrementTimeinDays()
  437.             {
  438.               
  439.                 if (isNaN(document.frmTask.txtTimeindays.value))
  440.                 {
  441.                     document.frmTask.txtTimeindays.value = parseInt(document.frmTask.hidTempTimeinDays.value)-1
  442.                             
  443.                 }else
  444.                 {
  445.                     document.frmTask.txtTimeindays.value =parseInt(document.frmTask.txtTimeindays.value,10)- 1
  446.                     document.frmTask.hidTempTimeinDays.value =document.frmTask.txtTimeindays.value 
  447.                     
  448.                         
  449.             }
  450.                 if (document.frmTask.txtTimeindays.value < 1)
  451.                 {
  452.                     document.frmTask.txtTimeindays.value = 365;
  453.                 
  454.                 }    
  455.             }
  456.             //Function to set the hidden varibales to be sent to the server
  457.             function SetData()
  458.             {
  459.                 document.frmTask.hidMaxLogsize.value=document.frmTask.txtMaximumlogsize.value
  460.                 document.frmTask.hidOverWritePolicy.value=getRadioButtonValue(document.frmTask.rdoOverwrite)
  461.                 document.frmTask.hidOverWriteOutDated.value=document.frmTask.txtTimeindays.value
  462.             }
  463.             
  464.             //Function to Enable\Disable the Textbox Timeindays
  465.             function Changemode(Overwritevalue)
  466.             {    
  467.                 if(Overwritevalue!="OutDated")
  468.                     document.frmTask.txtTimeindays.disabled=true
  469.                 else    
  470.                     document.frmTask.txtTimeindays.disabled=false
  471.             }
  472.         </script>
  473. <%    
  474.     End Function
  475.         
  476.     '-------------------------------------------------------------------------
  477.     'Function name:        GetLogProp
  478.     'Synopsis:            Serves in Getting the Properties of selected Log 
  479.     'Input Variables:    None    
  480.     'Output Variables:    None
  481.     'Returns:            True/False. True if successful in getting the properties of a selected log,
  482.     '                    false to indicate errors in getting the properties.
  483.     'Global Variables:    L_BYTES_TEXT,L_KB_TEXT,L_RETREIVEVALUES_ERRORMESSAGE,
  484.     '                    L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE
  485.     '                    F_strEvent,F_strCreated,F_strModified,F_strAccessed,F_strMaxLogsize,
  486.     '                    F_strOverwritePolicy,F_strOverwriteOutdated
  487.     '-------------------------------------------------------------------------
  488.     Function GetLogProp()
  489.         Err.Clear
  490.         On Error Resume Next
  491.         
  492.         Dim objConnection    'To get WMI connection
  493.         Dim objLogs            'To capture results after query execution
  494.         Dim objLog            'To process query results
  495.         Dim strQuery        'To capture the query
  496.  
  497.         Call SA_TraceOut(SA_GetScriptFileName(), "Entering GetLogProp")
  498.         
  499.         Dim oValidator
  500.         Set oValidator = new CSAValidator
  501.         If ( FALSE = oValidator.IsValidIdentifier(F_strEvent)) Then
  502.             Call SA_TraceOut(SA_GetScriptFileName(), "LogName is invalid: " & F_strEvent)
  503.             Call SA_ServeFailurepage(L_RETREIVEVALUES_ERRORMESSAGE)
  504.             Set oValidator = Nothing
  505.             Exit Function
  506.         End If
  507.         Set oValidator = Nothing
  508.         
  509.         strQuery  ="SELECT * FROM  Win32_NTEventlogFile WHERE LogfileName=" & chr(34) & F_strEvent & chr(34)
  510.                     
  511.         'getting wmi connection
  512.         set objConnection = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  513.         
  514.         If Err.number<>0 then 
  515.             SA_ServeFailurepage L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE
  516.             GetLogProp=False
  517.             Exit Function
  518.         End if    
  519.         
  520.         'executing the query necessary to get the log properties
  521.         Set objLogs = objConnection.ExecQuery(strQuery)
  522.         For each objLog in objLogs
  523.             'getting the values from system into form variables
  524.             F_strSize=FormatNumber((objLog.FileSize)/1024, 0) & L_KB_TEXT  & "(" & FormatNumber(objLog.FileSize,0) &" "& L_BYTES_TEXT &")" 
  525.             F_strCreated=Formatdates(objLog.CreationDate) 
  526.             F_strModified=Formatdates(objLog.LastModified)
  527.             F_strAccessed=Formatdates(objLog.LastAccessed)
  528.             F_strMaxLogsize=ConvertSINT_UINT((objLog.MaxFileSize))/1024
  529.             F_strOverwritePolicy=(objLog.OverWritePolicy)
  530.             If objLog.OverWriteOutdated=0 or objLog.OverWriteOutdated=-1  then
  531.                 F_strOverwriteOutdated=7
  532.             else
  533.                 F_strOverwriteOutdated=objLog.OverWriteOutdated
  534.             end if    
  535.         next
  536.             
  537.         If Err.number <> 0 then
  538.             SA_ServeFailurepage L_RETREIVEVALUES_ERRORMESSAGE
  539.             GetLogProp=False
  540.             Exit Function
  541.         End If    
  542.         
  543.         GetLogProp=True
  544.         'Destroying dynamically created objects after usage
  545.         Set objConnection=Nothing
  546.         Set objLogs=Nothing    
  547.                         
  548.     End Function
  549.     
  550.     '-------------------------------------------------------------------------
  551.     'Function name:        ConvertSINT_UINT
  552.     'Synopsis:            Converts Signed int to Unsigned int
  553.     'Input Variables:    number (Signed)
  554.     'Output Variables:    number (Unsigned)
  555.     'Returns:            None
  556.     'Global Variables:    None
  557.     '-------------------------------------------------------------------------
  558.     Function ConvertSINT_UINT(MaxFileSize)
  559.  
  560.         if( MaxFileSize >= 0 ) then
  561.             ConvertSINT_UINT = MaxFileSize
  562.             Exit function
  563.         end if
  564.         ConvertSINT_UINT = UINT_FORMAT + MaxFileSize
  565.  
  566.     End Function
  567.     
  568.     '-------------------------------------------------------------------------
  569.     'Function name:        Formatdates
  570.     'Synopsis:            Serves in formatting date according to display mode
  571.     'Input Variables:    strDate -date to be formatted    
  572.     'Output Variables:    None
  573.     'Returns:            strCreated  'Formatted date
  574.     'Global Variables:    None
  575.     '-------------------------------------------------------------------------
  576.     Function Formatdates(strDate)
  577.         
  578.         Err.Clear
  579.         On Error Resume Next
  580.         
  581.         Dim strDates
  582.         Dim strTime
  583.         Dim strTimeCreated
  584.         Dim strCreated
  585.         
  586.         strDates=Mid(strDate,1,4)& "-" & Mid(strDate,5,2) & "-" & Mid(strDate,7,2)
  587.         
  588.         strTime=Mid(strDate,9,6)
  589.             
  590.         if Mid(strTime,1,2)>12 then
  591.             strTimeCreated=((Mid(strTime,1,2))-12)& ":"& Mid(strTime,3,2)&":"&Mid(strTime,5,2) &" PM"
  592.         else    
  593.             strTimeCreated=Mid(strTime,1,2)& ":"& Mid(strTime,3,2)&":"&Mid(strTime,5,2)& " AM"
  594.         end if
  595.         strCreated= FormatDateTime(CDate(strDates),1)&","&" " &strTimeCreated
  596.         Formatdates=strCreated
  597.     
  598.     End Function
  599.  
  600.     '-------------------------------------------------------------------------
  601.     'Function name:        EditLogProp
  602.     'Synopsis:            Serves in editing the Properties of selected Log 
  603.     'Input Variables:    None    
  604.     'Output Variables:    None
  605.     'Returns:            True - if successful in editing the properties of a selected log 
  606.     '                    False - to indicate errors.
  607.     'Global Variables:    F_strEvent,F_strOverwritePolicy,F_strSize,F_strOverwriteOutdated,
  608.     '                    L_UPDATEVALUES_ERRORMESSAGE,L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE
  609.     '                    LL_RETREIVEVALUES_ERRORMESSAGE
  610.     '-------------------------------------------------------------------------
  611.     Function EditLogProp    
  612.         
  613.         Err.Clear 
  614.         On Error Resume Next
  615.         
  616.         Dim objConnection    'To get WMI connection
  617.         Dim objLogs            'To capture results after query execution
  618.         Dim objLog            'To process query results
  619.         Dim strQuery        'To capture the query
  620.         
  621.         const OVERWRITEOUTDATED=4294967295
  622.  
  623.         Call SA_TraceOut(SA_GetScriptFileName(), "Entering EditLogProp")
  624.         
  625.         Dim oValidator
  626.         Set oValidator = new CSAValidator
  627.         If ( FALSE = oValidator.IsValidIdentifier(F_strEvent)) Then
  628.             Call SA_TraceOut(SA_GetScriptFileName(), "LogName is invalid: " & F_strEvent)
  629.             Call SA_ServeFailurepage(L_RETREIVEVALUES_ERRORMESSAGE)
  630.             Set oValidator = Nothing
  631.             Exit Function
  632.         End If
  633.         Set oValidator = Nothing
  634.         
  635.         strQuery  ="SELECT * FROM  Win32_NTEventlogFile WHERE LogfileName=" & chr(34) & F_strEvent & chr(34)
  636.                 
  637.         'getting wmi connection
  638.         set objConnection = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  639.         
  640.         If Err.number<>0 then 
  641.             SA_SetErrMsg L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE
  642.             EditLogProp=false
  643.             Exit Function
  644.         End if
  645.         
  646.         'execute the necessary query to set the log properties
  647.         Set objLogs = objConnection.ExecQuery(strQuery)
  648.         
  649.         If Err.number <> 0 then
  650.             SA_SetErrMsg L_RETREIVEVALUES_ERRORMESSAGE     
  651.             EditLogProp=false
  652.             Exit Function
  653.         End If
  654.         
  655.         'editing log properties
  656.         For each objLog in objLogs
  657.             objLog.MaxFileSize=F_strMaxLogsize*1024
  658.             
  659.             if F_strOverwritePolicy="WhenNeeded" then
  660.                 objLog.OverWriteOutdated =0
  661.             elseif F_strOverwritePolicy="OutDated" then
  662.                 objLog.OverWriteOutdated =F_strOverwriteOutdated
  663.             elseif     F_strOverwritePolicy="Never" then
  664.                 objLog.OverWriteOutdated =OVERWRITEOUTDATED
  665.             end if
  666.             objLog.OverWritePolicy=F_strOverwritePolicy
  667.             objLog.Put_(WMICONST)
  668.         next
  669.             
  670.         If Err.number <> 0 then
  671.             SA_SetErrMsg L_UPDATEVALUES_ERRORMESSAGE
  672.             EditLogProp=false
  673.             Exit Function
  674.         End If
  675.         
  676.         EditLogProp=true
  677.         
  678.         'Destroying dynamically created objects after usage
  679.         Set objConnection=Nothing
  680.         Set objLogs=Nothing    
  681.     
  682.     End Function
  683. %>
  684.